
exports.CustomStoreIcon = UI.View.subclass ({
	
	load: function(storeObject) 
	{
		this.setIcon(storeObject);
	},

	setIcon: function(storeObject) 
	{
		var filePath = this.getBaseResourcePath(storeObject) + "thumb.png";
		this._iconImage = new UI.Image();
		this._iconImage.setImage(filePath);
		var frame = this.getFrame();
		this._iconImage.setFrame([0, 0, frame[2], frame[3]]);
		this._iconImage.setImageFit(UI.ViewGeometry.FitModes.Stretch);
		this.addChild(this._iconImage);
	},
	
	getBaseResourcePath: function(storeObject)
	{
		var key = GACommonUtils.getKeyForStoreObject(storeObject);
		var tempPath = key.split("_");
		var path = "./Content/images/storeimages/" + tempPath[0] + "/" + tempPath[1] + "/" + tempPath[2] + "/" +"default/";
		return path;
	},

	destroy: function() 
	{
		if(this._iconImage)
		{
			this._iconImage.destroy();
			this._iconImage = null;
		}
	}

});